/*
 * TextMarker.java
 *
 * Created on 6 maj 2007, 20:55
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package pl.krakow.ae.knp.wikiboard.gui.tools.markers;

import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
import javax.swing.JOptionPane;
import pl.krakow.ae.knp.wikiboard.gui.board.Board;
import pl.krakow.ae.knp.wikiboard.gui.board.BoardEvent;
import pl.krakow.ae.knp.wikiboard.gui.drawables.Drawable;
import pl.krakow.ae.knp.wikiboard.gui.drawables.Text;

/**
 *
 * @author m
 */

public class TextMarker extends Marker
{
    /** Creates a new instance of TextMarker */
    public TextMarker()
    {}
    
    public void mousePressed(MouseEvent event, Graphics2D g)
    {
        String string = JOptionPane.showInputDialog("Podaj tekst: ");
        if (string != null)
        {
            drawable = new Text(event.getPoint(), Board.getFgColor(), g, string);
            drawable.draw(g, false);
            BoardEvent e = createEvent();
            processBoardEvent(e);
        }
    }
    
    public void mouseDragged(MouseEvent event, Graphics2D g)
    {
        Point2D point = event.getPoint();
        drawable.move(point.getX(),point.getY());
    }
    
    public void mouseReleased(MouseEvent event, Graphics2D g)
    {
    }

}
